﻿// -----------------------------------------------------------------------
// <copyright file="PapControl.cs" company="Zen Design Corp">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Zen.BlackBerry.Pap.Control
{
	using System.Xml.Serialization;
	using Microsoft.Practices.ServiceLocation;
	using Zen.BlackBerry.Configuration;

	/// <summary>
	/// Base class for all PAP control objects.
	/// </summary>
	public class PapControl
	{
		private IPushProperties _pushProperties;

		/// <summary>
		/// Gets or sets a value indicating whether this instance is using public push.
		/// </summary>
		/// <value>
		/// <c>true</c> if this instance is using public (BIS) push;
		/// otherwise, <c>false</c> for enterprise (BES) push.
		/// </value>
		[XmlIgnore]
		public bool IsUsingPublicPush
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the push properties.
		/// </summary>
		/// <value>The push properties.</value>
		[XmlIgnore]
		public IPushProperties PushProperties
		{
			get
			{
				if (_pushProperties == null)
				{
					_pushProperties = ServiceLocator.Current
						.GetInstance<IPushProperties>();
				}
				return _pushProperties;
			}
			set
			{
				_pushProperties = value;
			}
		}
	}
}
